#include "PlayerObject.h"

PlayerObject::PlayerObject() :
Name( "" ),
IsDynamic( false ),
PosLowX( 0.0 ),
PosHighX( 0.0 ),
PosLowY( 0.0 ),
PosHighY( 0.0 ),
PosZ( 0.0 ),
VelX( 0.0 ),
VelY( 0.0 ),
VelYaw( 0.0 ),
SizeX( 0.0 ),
SizeY( 0.0 ),
SizeZ( 0.0 )
{
}

PlayerObject::~PlayerObject()
{
}

bool PlayerObject::isCollided( const double dX, const double dY, const double dR ) const
{
    if (( dX <= ( PosHighX + dR )) && ( dY >= ( PosLowY - dR )) && ( dY <= ( PosHighY + dR )) && ( dX >= ( PosLowX - dR )))
    {
        return true;
    }

    return false;
}

void PlayerObject::updatePos( const double dX, const double dY, const double dYaw )
{
    PosLowX = dX - SizeX / 2.0;
    PosHighY = dY + SizeY / 2.0;

    PosHighX = dX + SizeX / 2.0;
    PosLowY = dY - SizeY / 2.0;

    Yaw = dYaw;
}

void PlayerObject::updateVel( const double dX, const double dY, const double dYaw )
{
    VelX = dX;
    VelY = dY;
    VelYaw = dYaw;
}
